package com.aboat.action;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 新增
 *
 * @author aboat
 * @email clear_windy@yeah.net
 * @create 2017-04-09 17:21
 */
public class DelMinusRegularListener implements ActionListener {
    DefaultTableModel tableModel;
    JTable table;
    public DelMinusRegularListener(DefaultTableModel tableModel, JTable table) {
        this.tableModel = tableModel;
        this.table = table;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        int row = table.getSelectedRow();
        if(row>-1){
            tableModel.removeRow(row);
        }
    }
}
